﻿@using System.Globalization
@model PagedList.IPagedList<DoAnForum.Models.Comment>
@foreach (var item in Model)
    {
        Html.RenderAction("ShowComment", "Share", new { id = item.CommentId });
    }
    <script>
    $(document).ready(function () {
        var page = @ViewBag.pageNumber;
        var id = "cmpage" + page;
        $(".pagingbar a").removeClass("cmpageActive");
        $('#' + id).addClass('cmpageActive');
    });
</script>

@if (Model.PageCount > 1)
{
    <div class="pagingbar">
        @Ajax.ActionLink("Đầu", "ShowTopicPartial", new {page = 1}, new AjaxOptions {UpdateTargetId = "cmlist"})
        @Ajax.ActionLink("<", "ShowTopicPartial", new {page = Model.PageNumber - 1}, new AjaxOptions {UpdateTargetId = "cmlist"})
        @for (int i = 1; i <= Model.PageCount; i++)
        {
            var page = i.ToString(CultureInfo.InvariantCulture);
            @Ajax.ActionLink(page, "ShowTopicPartial", new {page = i}, new AjaxOptions {UpdateTargetId = "cmlist"}, new {@id = "cmpage" + page})
        }
        @Ajax.ActionLink(">", "ShowTopicPartial", new {page = Model.PageNumber + 1}, new AjaxOptions {UpdateTargetId = "cmlist"})
        @Ajax.ActionLink("Cuối", "ShowTopicPartial", new {page = Model.PageCount}, new AjaxOptions {UpdateTargetId = "cmlist"})
    </div>
}